//
//  TGNavigationController.m
//  GroupBuy
//
//  Created by wwj on 15/11/2.
//  Copyright © 2015年 wwj. All rights reserved.
//

#import "TGNavigationController.h"

#import "UIImage+Extend.h"

@interface TGNavigationController ()

@end

@implementation TGNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
}

+(void)initialize{
    
    // 1.设置导航栏主题
    [self setupNavBarTheme];
    
    // 2.设置导航栏按钮主题
    [self setupBarButtonItemTheme];
   
}

#pragma -mark 设置导航栏主题
+ (void)setupNavBarTheme{
    UINavigationBar *navBar = [UINavigationBar appearance];
    // 设置导航栏的背景图片
    [navBar setBackgroundImage:[UIImage imageNamed:@"bg_deal"] forBarMetrics:UIBarMetricsDefault];
    // 设置标题属性
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName] = [UIColor blackColor];
    [navBar setTitleTextAttributes:textAttrs];
}

+ (void)setupBarButtonItemTheme{
    UIBarButtonItem *item = [UIBarButtonItem appearance];
    // 设置默认文字属性
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
    textAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:16];
    [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
    [item setTitleTextAttributes:textAttrs forState:UIControlStateHighlighted];
    
    // 修改item的背景图片
    [item setBackgroundImage:[UIImage resizedImage:@"bg_navigation_right"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    [item setBackgroundImage:[UIImage resizedImage:@"bg_navigation_right_hl"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
    
    //设置状态栏样式
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}

@end
